package com.pdemo.front.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pdemo.core.dao.UserDao;
import com.pdemo.core.entity.Borrower;
import com.pdemo.core.entity.User;

@Service("borrowerService")
public class BorrowerService {
	@Autowired
	@Qualifier("userDao")
	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
	
	@Transactional
	public Long createBorrower(User user){
		userDao.save(user);
		return user.getId();
	}
	
	
	public List<Borrower> getAllBorrowers(){
		return userDao.getAllBorrowers();
	}
	
}
